package com.ruoyi.iot;

import com.ruoyi.iot.handler.MqttMessageHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class MqttMessageHandlerFactory {

    @Autowired
    private Map<String, MqttMessageHandler> messageHandlerMap;

    /**
     * 特殊的topic，自己增加handler即可，此处仅为示例。
     */
    public  MqttMessageHandler getMessageHandler(String messageType) {
        return  messageHandlerMap.get(messageType);
    }

}
